﻿using System;
using System.Collections;

namespace TextEditor
{
    

    public class A_ClearSaveLog : A_Action
    {
        public override string ActionName()
        {
            return "clearsavelog";
        }

        public override bool Execute()
        {
            ArrayList myList = new ArrayList();
            myList.Add(base.myOwnerDocument.DocumentElement);
            base.myOwnerDocument.DocumentElement.AddElementToListAbs(myList);
            foreach (ZYTextElement element in myList)
            {
                element.Attributes.RemoveAttribute("creator");
                element.Attributes.RemoveAttribute("deleter");
                element.DeleterIndex = -1;
            }
            base.myOwnerDocument.SaveLogs.Clear();
            base.myOwnerDocument.Info.VisibleUserLevel = -1;
            base.myOwnerDocument.Marks.Clear();
            base.myOwnerDocument.RefreshElements();
            base.myOwnerDocument.RefreshLine();
            base.myOwnerDocument.UpdateView();
            return true;
        }
    }
}

